﻿using Nop.Services.Events;
using Nop.Web.Framework.Seo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Nop.Web.WindAlert
{
    public partial class HzEventConsumer : IConsumer<CustomUrlRecordEntityNameRequested>
    {
        public void HandleEvent(CustomUrlRecordEntityNameRequested eventMessage)
        {
            switch (eventMessage.UrlRecord.EntityName.ToLowerInvariant())
            {
                case "camera":
                    {
                        eventMessage.RouteData.Values["controller"] = "WCamera";
                        eventMessage.RouteData.Values["action"] = "Camera";
                        eventMessage.RouteData.Values["cameraid"] = eventMessage.UrlRecord.EntityId;
                        eventMessage.RouteData.Values["SeName"] = eventMessage.UrlRecord.Slug;
                    }
                    break;
                case "station":
                    {
                        eventMessage.RouteData.Values["controller"] = "Wind";
                        eventMessage.RouteData.Values["action"] = "ChartPage";
                        eventMessage.RouteData.Values["stationid"] = eventMessage.UrlRecord.EntityId;
                        eventMessage.RouteData.Values["SeName"] = eventMessage.UrlRecord.Slug;
                    }
                    break;
               case "spot":
                    {
                        eventMessage.RouteData.Values["controller"] = "WSpot";
                        eventMessage.RouteData.Values["action"] = "Spot";
                        eventMessage.RouteData.Values["spotid"] = eventMessage.UrlRecord.EntityId;
                        eventMessage.RouteData.Values["SeName"] = eventMessage.UrlRecord.Slug;
                    }
                    break;
            }

        }
    }
}